# -*- coding: utf-8 -*-
# @Author   : Claus
# @Time     : 2020/6/30 16:56
# @FileName : 连接redis - 2.py
from redis import ConnectionPool
from redis import Redis


'''
    使用连接池连接redis中的    Redis
'''


# 创建pool
pool = ConnectionPool(host='localhost', port=6379, db=0, decode_responses=True)
# 传入pool
db = Redis(connection_pool=pool)
# 下方是获取操作结果
resu = db.hget('mark', "name")
resu2 = db.hmget('mark', 'name', "age", "h")
resu3 = db.hgetall("mark")
# 下方是输出操作结果
print(resu, type(resu), sep=" 类型是: ")
print(resu2, type(resu2), sep=" 类型是: ")
print(resu3, type(resu3), sep=" 类型是: ")
